%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% coding: utf-8

%% DEPRECATED!
%% TODO: This entire block assumes there's just one node in the tests which is false.
%%       Stop using it as soon as possible (i.e. convert suites to use `hosts` defined below).
%%       See s2s_SUITE for example on using `hosts` to RPC into nodes (uses CT "require").
%% the Erlang node name of tested ejabberd/MongooseIM
{ejabberd_node, 'mongooseim@localhost'}.
{ejabberd2_node, 'mongooseim2@localhost'}.
{ejabberd_cookie, mongooseim}.
{ejabberd_string_format, bin}.

%% TODO: in every new use case this should be used instead
%%       of ejabberd_node, ejabberd2_node, ejabberd_domain,
%%       ejabberd_secondary_domain, ...
%% TODO: introduce host option verification ASAP,
%%       so that we rein the "bag of things" approach
{hosts, [{mim,  [{node, mongooseim@localhost},
                 {domain, <<"localhost">>},
                 {host_type, <<"localhost">>},
                 {vars, "mim1"},
                 {cluster, mim},
                 {secondary_domain, <<"localhost.bis">>},
                 {secondary_host_type, <<"localhost.bis">>},
                 {anonymous_host_type, <<"anonymous.localhost">>},
                 {muc_service, <<"muc.localhost">>},
                 {muc_service_pattern, <<"muc.@HOST@">>},
                 {muc_light_service, <<"muclight.localhost">>},
                 {muc_light_service_pattern, <<"muclight.@HOST@">>},
                 {s2s_port, 5269},
                 {incoming_s2s_port, 5269},
                 {c2s_port, 5222},
                 {c2s_tls_port, 5223},
                 {cowboy_port, 5280},
                 {cowboy_secure_port, 5285},
                 {http_api_client_endpoint_port, 8089},
                 {component_port, 8888},
                 {kicking_component_port, 8666},
                 {hidden_component_port, 8189},
                 {tls_component_port, 8190},
                 {gd_endpoint_port, 5555},
                 {http_notifications_port, 8000},
                 {blocks_hosts, [reg]}]},
         {mim2, [{node, mongooseim2@localhost},
                 {domain, <<"localhost">>},
                 {host_type, <<"localhost">>},
                 {vars, "mim2"},
                 {cluster, mim},
                 {c2s_tls_port, 5233},
                 {gd_endpoint_port, 6666},
                 {component_port, 8899}]},
         {mim3, [{node, mongooseim3@localhost},
                 {domain, <<"localhost">>},
                 {host_type, <<"localhost">>},
                 {vars, "mim3"},
                 {c2s_tls_port, 5263},
                 {cluster, mim}]},
         %% used to test s2s features
         {fed,  [{node, fed1@localhost},
                 {domain, <<"fed1">>},
                 {secondary_domain, <<"fed2">>},
                 {host_type, <<"fed1">>},
                 {vars, "fed1"},
                 {incoming_s2s_port, 5299},
                 {c2s_port, 5242},
                 {cluster, fed}]},
         %% used to test global distribution features
         {reg,  [{node, reg1@localhost},
                 {domain, <<"reg1">>},
                 {host_type, <<"red1">>},
                 {vars, "reg1"},
                 {component_port, 9990},
                 {c2s_port, 5252},
                 {gd_endpoint_port, 7777},
                 {gd_extra_endpoint_port, 10000},
                 {gd_supplementary_endpoint_port, 10001},
                 {cluster, reg}]}
        ]}.

%% Use RPC and ejabberd_auth API for creating/deleting test users
{escalus_user_db, {module, escalus_ejabberd}}.
{escalus_xmpp_server, escalus_mongooseim}.

%% Use modules that implement the escalus_user_db behaviour:
%% {escalus_user_db, {module, escalus_ejabberd}}. % RPC-based registration
%% {escalus_user_db, {module, YourModule}}.
%% {escalus_user_db, {module, YourModule, ListOfOptions}}.

%% Log all stanzas sent and received (consumed) in the test cases:
%% - to `file'
%% - to `console'
%% - to `console_and_file' (legacy `true' also enables this mode)
{stanza_log, file}.

{escalus_users, [
    {alice, [
        {username, <<"alicE">>},
        {server, <<"localhost">>},
        {password, <<"matygrysa">>}]},
    {alice_bis, [
        {username, <<"alicE">>},
        {server, <<"localhost.bis">>},
        {host, <<"localhost">>},
        {password, <<"matygrysa">>}]},
    {bob, [
        {username, <<"bOb">>},
        {server, <<"localhost">>},
        {password, <<"makrolika">>}]},
    {carol, [
        {username, <<"carol">>},
        {server, <<"localhost">>},
        {password, <<"jinglebells">>},
        {transport, escalus_bosh},
        {path, <<"/http-bind">>},
        {port, 5280}]},
    {carol_s, [
        {username, <<"carol_s">>},
        {server, <<"localhost">>},
        {password, <<"jinglebells_s">>},
        {transport, escalus_bosh},
        {ssl, true},
        {path, <<"/http-bind">>},
        {port, 5285},
        {ssl_opts, [{verify, verify_none}]}]},
    {kate, [
        {username, <<"kate">>},
        {server, <<"localhost">>},
        {password, <<"makrowe;p">>}]},
    {mike, [
        {username, <<"mike">>},
        {server, <<"localhost">>},
        {password, <<"nicniema">>}]},
    {john, [
        {username, <<"john">>},
        {server, <<"localhost">>},
        {password, <<"cosontuma">>}]},
    {geralt, [
        {username, <<"geralt">>},
        {server, <<"localhost">>},
        {password, <<"witcher">>},
        {transport, escalus_ws},
        {port, 5280},
        {wspath, <<"/ws-xmpp">>}]},
    {geralt_s, [
        {username, <<"geralt_s">>},
        {server, <<"localhost">>},
        {password, <<"witcher_s">>},
        {transport, escalus_ws},
        {ssl, true},
        {port, 5285},
        {wspath, <<"/ws-xmpp">>},
        {ssl_opts, [{verify, verify_none}]}]},
    {hacker, [
        {username, <<"hacker">>},
        {server, <<"localhost">>},
        {password, <<"bringdowntheserver">>},
        {port, 5223}]},
    {admin, [
        {username, <<"admin">>},
        {server, <<"localhost">>},
        {password, <<"bruce_almighty">>}]},
    {secure_joe, [
        {username, <<"secure_joe">>},
        {server, <<"localhost">>},
        {password, <<"break_me">>},
        {starttls, required}]},
    {astrid, [
        {username, <<"astrid">>},
        {server, <<"sogndal">>},
        {host, <<"localhost">>},
        {password, <<"doctor">>}]},
    {alice2, [ %% used in s2s_SUITE
        {username, <<"alice">>},
        {server, <<"fed1">>},
        {host, <<"localhost">>},
        {port, 5242},
        {password, <<"makota2">>}]},
    {bob2, [
        {username, <<"bob">>},
        {server, <<109,105,99,104,97,197,130>>}, %% <<"michał"/utf8>>
        {host, <<"localhost">>},
        {port, 5242},
        {password, <<"makota3">>}]},
    {clusterguy, [
        {username, <<"clusterguy">>},
        {server, <<"localhost">>},
        {host, <<"localhost">>},
        {password, <<"distributionftw">>},
        {port, 5232}]},
    {clusterbuddy, [
        {username, <<"clusterbuddy">>},
        {server, <<"localhost">>},
        {host, <<"localhost">>},
        {password, <<"wasssssssup">>},
        {port, 5232}]},
    {eve, [ %% used in mod_global_distrib_SUITE
        {username, <<"eve">>},
        {server, <<"localhost">>},
        {password, <<"password">>},
        {port, 5252}]},
    {adam, [ %% used in mod_global_distrib_SUITE, websockets
        {username, <<"adam">>},
        {server, <<"localhost">>},
        {password, <<"password">>},
        {transport, escalus_ws},
        {port, 5272},
        {wspath, <<"/ws-xmpp">>}]},
    {neustradamus, [
        {username, <<"neustradamus">>},
        {server, <<"localhost">>},
        {host, <<"localhost">>},
        {password, <<"scramshaplus">>},
        {starttls, required}
    ]},
    {alice3, [ %% used in dynamic_domains_SUITE
        {username, <<"alice">>},
        {server, <<"example.com">>},
        {host, <<"localhost">>},
        {password, <<"makota2">>}]},
    {bob3, [ %% used in dynamic_domains_SUITE
        {username, <<"bob">>},
        {server, <<"example.org">>},
        {host, <<"localhost">>},
        {password, <<"makota3">>},
        {port, 5232}]}
]}.

{escalus_anon_users, [
    {jon, [
        {username, <<"jon">>},
        {server, <<"anonymous.localhost">>},
        {host, <<"localhost">>},
        {auth_method, <<"SASL-ANON">>}]},
    {anna, [
        {username, <<"anna">>},
        {password, <<"ignored">>},
        {server, <<"anonymous.localhost">>},
        {host, <<"localhost">>}]}
]}.

{presets,
 [{toml,
   [
    {internal_mnesia,
     %% dbs variable is used by ./tools/test_runner/presets_to_dbs.sh script
     [{dbs, [redis, minio]},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]"}]},

    {pgsql_cets,
     [{dbs, [redis, pgsql]},
      {sm_backend, "\"cets\""},
      {bosh_backend, "\"cets\""},
      {component_backend, "\"cets\""},
      {s2s_backend, "\"cets\""},
      {stream_management_backend, cets},
      {auth_anonymous_backend, cets},
      {auth_method, "rdbms"},
      {internal_databases, "[internal_databases.cets]
  cluster_name = \"{{cluster_name}}\""},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.rdbms.default]
  scope = \"global\"
  workers = 5
  connection.driver = \"pgsql\"
  connection.host = \"localhost\"
  connection.database = \"mongooseim\"
  connection.username = \"mongooseim\"
  connection.password = \"mongooseim_secret\"
  connection.tls.required = true
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.server_name_indication.enabled = false"},
      {service_domain_db, ""},
      {mod_vcard, "  backend = \"rdbms\"
  host = \"vjud.@HOST@\"\n"},
      {mod_roster, "  backend = \"rdbms\"\n"}]},

    {cockroachdb_cets,
     [{dbs, [redis, cockroachdb]},
      {sm_backend, "\"cets\""},
      {bosh_backend, "\"cets\""},
      {component_backend, "\"cets\""},
      {s2s_backend, "\"cets\""},
      {stream_management_backend, cets},
      {auth_anonymous_backend, cets},
      {auth_method, "rdbms"},
      {internal_databases, "[internal_databases.cets]
  cluster_name = \"{{cluster_name}}\""},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.rdbms.default]
  scope = \"global\"
  workers = 5
  connection.driver = \"cockroachdb\"
  connection.host = \"localhost\"
  connection.port = 26257
  connection.database = \"mongooseim\"
  connection.username = \"mongooseim\"
  connection.password = \"mongooseim_secret\"
  connection.tls.required = true
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.server_name_indication.enabled = false"},
      {service_domain_db, ""},
      {mod_vcard, "  backend = \"rdbms\"
  host = \"vjud.@HOST@\"\n"},
      {mod_roster, "  backend = \"rdbms\"\n"}]},

    {pgsql_mnesia,
     [{dbs, [redis, pgsql]},
      {auth_method, "rdbms"},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.rdbms.default]
  scope = \"global\"
  workers = 5
  connection.driver = \"pgsql\"
  connection.host = \"localhost\"
  connection.database = \"mongooseim\"
  connection.username = \"mongooseim\"
  connection.password = \"mongooseim_secret\"
  connection.tls.required = true
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.server_name_indication.enabled = false"},
      {service_domain_db, ""},
      {mod_vcard, "  backend = \"rdbms\"
  host = \"vjud.@HOST@\"\n"},
      {mod_roster, "  backend = \"rdbms\"\n"}]},

    {odbc_mssql_mnesia,
     [{dbs, [redis, mssql]},
      {auth_method, "rdbms"},
      {rdbms_server_type, "\"mssql\""},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.rdbms.default]
  scope = \"global\"
  workers = 5
  connection.driver = \"odbc\"
  connection.settings = \"DSN=mongoose-mssql;UID=sa;PWD=mongooseim_secret+ESL123\""},
      {service_domain_db, ""},
      {mod_vcard, "  backend = \"rdbms\"
  host = \"vjud.@HOST@\"\n"},
      {mod_roster, "  backend = \"rdbms\"\n"}]},

{mysql_redis,
     [{dbs, [redis, mysql, rmq]},
      {sm_backend, "\"redis\""},
      {auth_method, "rdbms"},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.redis.default]
  scope = \"global\"
  workers = 10
  strategy = \"random_worker\"
  connection.database = {{redis_database_number}}
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.rdbms.default]
  scope = \"global\"
  workers = 5
  connection.driver = \"mysql\"
  connection.host = \"localhost\"
  connection.database = \"mongooseim\"
  connection.username = \"mongooseim\"
  connection.password = \"mongooseim_secret\"
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]"},
      {service_domain_db, ""},
      {mod_vcard, "  backend = \"rdbms\"
  host = \"vjud.@HOST@\"\n"},
      {mod_roster, "  backend = \"rdbms\"\n"}]},

    {ldap_mnesia,
     [{dbs, [redis, ldap]},
      {auth_method, "ldap"},
      {outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.ldap.default]
  scope = \"global\"
  workers = 5
  connection.port = 3636
  connection.root_dn = \"cn=admin,dc=esl,dc=com\"
  connection.password = \"mongooseim_secret\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.certfile = \"priv/ssl/fake_cert.pem\"
  connection.tls.keyfile = \"priv/ssl/fake_key.pem\"
[outgoing_pools.ldap.bind]
  scope = \"global\"
  workers = 5
  connection.port = 3636
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.certfile = \"priv/ssl/fake_cert.pem\"
  connection.tls.keyfile = \"priv/ssl/fake_key.pem\""},
      {password_format, "password.format = \"scram\""},
      {auth_method_opts, "base = \"ou=Users,dc=esl,dc=com\"
    filter = \"(objectClass=inetOrgPerson)\""},
      {mod_vcard, "  backend = \"ldap\"
  host = \"vjud.@HOST@\"
  ldap.base = \"ou=Users,dc=esl,dc=com\"
  ldap.filter = \"(objectClass=inetOrgPerson)\"\n"}]},

    {elasticsearch_and_cassandra_mnesia,
     [{dbs, [redis, elasticsearch, cassandra]},
{outgoing_pools, "[outgoing_pools.redis.global_distrib]
  scope = \"global\"
  workers = 10
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
  connection.tls.versions = [\"tlsv1.2\", \"tlsv1.3\"]
[outgoing_pools.cassandra.default]
  scope = \"global\"
  workers = 20
  connection.servers = [{host = \"localhost\", port = 9142}]
  connection.tls.cacertfile = \"priv/ssl/cacert.pem\"
[outgoing_pools.elastic.default]
  scope = \"global\""}
     ]}
   ]}
 ]}.

{timetrap,{seconds,30}}.
{sensible_maximum_repeats, 100}.

%% Log drop stanza in parallel stories in mam_SUITE.
%% Helps with debugging mam test cases.
%{log_parallel_story_stanza_drop, true}.

%% vim: ft=erlang
